-- NewBagController

local NewBagView = require("app.newBag.views.NewBagView")

local BagSellView = import("..views.BagSellView")
local BagPgActView = import("..views.BagPgActView")

local RenamePlayerView = import("..views.RenamePlayerView")
local NewguildCreateView = require("app.newGuild.views.NewguildCreateView")

local TransAttrOfEquip = import("..views.TransAttrOfEquip")

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ControllerBase)

-- 幻化部位个数
local ClothesPanel_Top_OpItemNum = 6 -- 与 NewClothesPanel 中保持一致

function ClassRef:ctor(params)
	self.super.ctor(self, params)
end

function ClassRef:init()
	self._model = app:getInst("NewBagModel")

	-- 当前所处panel标签
	-- 1.背包 2.宝物 3.时装 4.称号 5.声望
	self._curPanelIdx = 1

	-- 背包操作tag
	-- 1.全部 2.装备 3.宝石 4.材料 5.其他
	self._curBagIdx = 1

	-- 时装操作tag
	-- 对应关系 fashion_subkey表
	self._curClothesIdx = 1

	-- 1.普通点击 3.批量分解
	self._opType = 1

	-- 在bagScrollView还未刷新完成时，保存背包数据的更新
	self._bagUpdateList = nil
	-- 在MultSV还未刷新完成时，保存对其数据的更新
	self._multUpdateList = nil

	-- 临时存放批量操作选中的renders
	self._multSelectDict = nil
	self._multSelectNum = 0

	self._playerHandler = UD.player:onChanged(handler(self, self.updatePlayer))
	self._walletHandler = UD:onChanged("wallet", handler(self, self.updatePlayer))
	self._bagHandler = UD.bag:onChanged(handler(self, self.updateBag))
	self._equipHandler = UD:onChanged("equip", handler(self, self.updateEquip))
	self._equipGridHandler = UD:onChanged("equipGrid", handler(self, self.updateEquipGrid))
	self._bagExHandler = UD:onChanged("bagExtend", handler(self, self.updateBagExtend))
	self._fameChangedHandler = UD:onChanged("fame", function()
		if self:isViewAlive() and 5 == self._curPanelIdx then -- 声望
			self:_refreshPanel( true )
		end
	end)
	self._pvpBoxChangeHandler = EM:on("onPvpBoxNumMayChange", handler(self, self.onRareChange))
	self.redPointHandler = UD.redPoint:onChanged(handler(self, self._onRedPointChange))

end

function ClassRef:removeListeners()
	self.super.removeListeners(self)
	UD.player:unChanged(self._playerHandler)
	UD.bag:unChanged(self._bagHandler)
	UD:unChanged("equip", self._equipHandler)
	UD:unChanged("equipGrid", self._equipGridHandler)
	UD:unChanged("bagExtend", self._bagExHandler)
	UD:unChanged("fame", self._fameChangedHandler)
	UD:unChanged("wallet", self._walletHandler)
	EM:remove(self._pvpBoxChangeHandler)
	UD.redPoint:unChanged(self.redPointHandler)
end

function ClassRef:listEvent()
    return {}
end

function ClassRef:onEvent(eventName, data)
end

function ClassRef:openView(data)
	if cc.isDead(self._view) then
		self._view = NewBagView.new( app.mvc.VIEWTYPE_BLUR )
		self._view:onCloseView(handler(self, self.closeView))
		self._view:onClearView(handler(self, self.clearView))
		self._view:onOperate(handler(self, self.onOperate))
		self._view:onSwitchPanel(handler(self, self.onSwitchPanel))
		self._view:onSwitchOpType(handler(self, self.onSwitchOpType))
		self:addChild(self._view)
	end

	local setTargetIdx = 1
	if data and data.idx then
		setTargetIdx = tonumber( data.idx )
	end
	self._view:show( setTargetIdx )
	self._view:updateGold( UD:getGold() )
	self._view:updateMagicCrystal( UD:getMagicCrystal() )
	self._view:updateBagInfo(self._model:getBagInfo(), self._model:getCurNum(), self._model:getMaxNum())

	local isOpen = UIHandler:isFunctionOpen(Constant.FUNC_TYPE_SELL_ITEM)
	self._view:refreshSellBtn(isOpen)
	
	self._view:refreshRedPoint()
	self:refreshPropAndCombatPower()

	if data and data.showQuickStrength then
		self._view:setDefaultSelectEquipOnStrength()
	end
end
function ClassRef:closeView(data)
	if self._view then
		self:removeChild(self._view, data)
	end
end
function ClassRef:clearView(data)
	self._multSelectDict = nil
	self._bagUpdateList = nil
	self._multUpdateList = nil
	self._model:clearBag()
	self._model:clearAllNew()

	-- UD:clearCharmNumNew()
	UD:clearClothesNewByIdx()
	UD:clearNewGotTitleList()
	UD:clearNewGotRenown()

	UD.redPoint:clearStateByKey(Constant.FUNC_TYPE_PACK)

	self._curPanelIdx = 1
	self._curPanelIdx = 0
	self._curBagIdx = 1
	self._curClothesIdx = 1
	self._opType = 1

	self._multSelectNum = 0

	self._clothesInit = false

	if self._view then
		self._view = nil
	end
end

--弹出改名卡界面
function ClassRef:showRenamePlayerView()
	if cc.isDead(self._renamePlayerView) then
		self._renamePlayerView = RenamePlayerView.new( app.mvc.VIEWTYPE_BLUR )
		self._renamePlayerView:onCloseView(handler(self, self.closeRenamePlayerView))
		self._renamePlayerView:onClearView(handler(self, self.clearRenamePlayerView))
		self._renamePlayerView:onOperate(handler(self, self.onOperate))
		self:addChild(self._renamePlayerView)
	end

	self._renamePlayerView:show()
end

function ClassRef:closeRenamePlayerView(data)
	if self._renamePlayerView then
		self:removeChild(self._renamePlayerView, data)
	end
end

function ClassRef:clearRenamePlayerView(data)
	self._renamePlayerView = nil
end


function ClassRef:showRenameGuildView()
	if cc.isDead(self._renameGuildView) then
		local model = app:getInst("NewguildModel")

		local baseColorList = model:getBaseIconColorList()
		local additionalColorList = model:getAdditionalIconColorList()

		self._renameGuildView = NewguildCreateView.new( app.mvc.VIEWTYPE_BLUR, {baseColorList, additionalColorList, true} )
		self._renameGuildView:onCloseView(handler(self, self.closeRenameGuildView))
		self._renameGuildView:onClearView(handler(self, self.clearRenameGuildView))
		self._renameGuildView:onOperate(handler(self, self.onOperate))
		self:addChild(self._renameGuildView)
	end

	self._renameGuildView:show()
end

function ClassRef:closeRenameGuildView(data)
	if self._renameGuildView then
		self:removeChild(self._renameGuildView, data)
	end
end

function ClassRef:clearRenameGuildView(data)
	self._renameGuildView = nil
end


function ClassRef:refreshPlayerPanelAfterQuickStrength(lvGrids)
	if not self:isViewAlive() then return end
	self._view:updatePlayerAllEquipGrids(lvGrids)
	self:updateRecastMaster()
end

function ClassRef:showBagUpView() -- 背包扩展
	if not self:isViewAlive() then return end

	local bagInfo = self._model:getBagInfo()
	if bagInfo.nextConf then -- 存在下级扩展数据？
		-- self._view:showBagUpView( bagInfo )
		local NewBagUpView = require("app.newBag.views.NewBagUpView")
		local view = NewBagUpView.new()
		view:onCloseView(function(sender)
			self._bagUpView = nil
			if self._view then
				self._view:hideBagUpView()
			end

			UIHandler:removePopupUiByKey(sender:getViewName())
		end)
		view:onOperate(handler(self, self.onOperate))
		UIHandler:addPopupUi(view, view:getViewName())
		self._bagUpView = view
		-- self:refreshView(true)
		view:setData(bagInfo)
		view:show()

		if self._view then
			self._view:showBagUpView()
		end
	else
		app:popMessage( "bagmax" )
	end
end

function ClassRef:showBagSellView( item ) -- 出售
	local view = BagSellView.new( nil, item )
	view:onCloseView(function() self:removeChild(view, {isFade=false}) end)
	view:onOperate(handler(self, self.onOperate))
	self:addChild(view)
	view:show()
end

function ClassRef:showBagPgActView( data ) -- 分解
	if not self:isViewAlive() then return end
	self._view:clearTips( true )
	local view = BagPgActView.new( nil, data )
	view:setName( BagPgActView:getViewName() )
	view:onCloseView(function() view:removeFromParent( true ) end)
	view:onOperate(handler(self, self.onOperate))
	self._view:addChild(view)
end

function ClassRef:playBreakSuccessAnim() -- 分解成功
	if not self:isViewAlive() then return end
	local view = self._view:getChildByName( BagPgActView:getViewName() )
	if not cc.isDead( view ) and view:isVisible() then
		view:playSuccessAnim()
	end
end

function ClassRef:breakFailed() -- 分解失败
	if not self:isViewAlive() then return end
	local view = self._view:getChildByName( BagPgActView:getViewName() )
	if not cc.isDead( view ) and view:isVisible() then
		view:removeFromParent( true )
	end
end

function ClassRef:showTransAttrView( data, flag ) -- 属性转移 flag是否是万能属性条卷轴
	self._view:clearTips( true )

	local view = TransAttrOfEquip.create( nil, data )
	view:setPosition( cc.p( display.width/2 , display.height/2 ) )

	view:onCloseView(function() view:removeFromParent( true ) end)
	view:onOperate(handler(self, self.onOperate))

	if flag then
		view:refreshTransAttrView(data)
	else
		view:setData( data )
	end
	self._view:addChild(view)
end

function ClassRef:useItem(item)
	local tp = item.type
	if tp == Enums.ItemType.partnerExp then -- 随从药水
		self:closeView()
		UIHandler:handleMessage({id = Constant.FUNC_TYPE_MERCENARY,mode = "open"})
	elseif tp == Enums.ItemType.wildBoss then -- 野外boss门票
		self:closeView()
		app:sendMsg("SummonBossController", "openView", {item:getUid(), item:getId()})
	elseif item:isAssociateBox() then -- 关联的道具
		self:closeView()
		app:sendMsg("SummonBossController", "openBoxView", item)
	elseif tp == Enums.ItemType.transattr then -- 属性条卷轴
		if item:canTransAttr() then
			self:showTransAttrView( item.uid )
		end
	elseif tp == Enums.ItemType.allAttrScroll then -- 万能属性条卷轴
		if item:allAttrScrollCanTransAttr() then
			self:showTransAttrView(item.uid, true)
		end
	else
		-- 如果是依赖其他的道具使用的，提前检查一下
		local itemId = item:getDependOnId()
		if itemId then
			local storageItem = UD:getItemByTid( itemId )
			if storageItem then
				display.pushToast( L("tips_1040016") )
				return
			end
		end
		self:onOperate( "useItem", item.uid, item.tid, 1 )
	end
end

function ClassRef:refreshPropAndCombatPower()
	if not self:isViewAlive() then return end
	self._view:updateProp(self._model:getAttrList())
	self._view:updateStrengthenInfo()
	self._view:updateCombatPower()
end

function ClassRef:updateProp()
	if not self:isViewAlive() then return end
	self._view:updateProp(self._model:getAttrList())
end

function ClassRef:updateRecastMaster()
	if not self:isViewAlive() then return end
	local curMasterList, nextMasterList = self._model:getRecastMaster()
	self._view:updateRecastMaster(curMasterList, nextMasterList)
end

------------------------------ model update------------------------
function ClassRef:updatePlayer(name, old, new)
	if not self:isViewAlive() then 
		if name == "charm" or name == "eventPoint" then
			RedPointHandler.onRareChange()
		end
		return 
	end
	if name == "magicCrystal" then
		self._view:updateMagicCrystal(new)
	elseif name == "gold" then
		self._view:updateGold(new)
	elseif name == "magicDust" then
		self._view:updateMagicDust( new )
	elseif name == "mountUID" then

	elseif name == "combatPower" then
		self:refreshPropAndCombatPower()
	elseif name == "name" then
		self._view:updatePlayerName( new )
	elseif name == "charm" or name == "eventPoint" then
		self:onRareChange()
	end
end

function ClassRef:onRareChange()
	if not self:isViewAlive() then 
		RedPointHandler.onRareChange()
		return 
	end
	RedPointHandler.onRareChange()
	if self._curPanelIdx == 2 then
		local panelTemp = self._view:getRightPanelByIndex( self._curPanelIdx )
		panelTemp:refreshView()
	end
end

function ClassRef:updateEquip(uid, equip, opt, pos)
	if not self:isViewAlive() then return end
	self._view:updatePlayerEquip(pos, equip, opt)

	if "update" ~= opt then
		self:refreshBagItemStatus( pos )
	end
end

function ClassRef:updateEquipGrid(equipGrid, preFashionId, hasAvatarChange, hasHiddenChange)
	if not self:isViewAlive() then return end
	self._view:updatePlayerClothesByPos(equipGrid, preFashionId, hasAvatarChange, hasHiddenChange)
	self:_clothesPanelChangedIdx()
end

function ClassRef:updateBagExtend()
	self._model:updateBagExtend()
	if not self:isViewAlive() then return end
	self._view:updateBagInfo(self._model:getBagInfo(), self._model:getCurNum(), self._model:getMaxNum())

	-- 添加新的空格子
	-- local bgSV = self._view:getScrollView()
	-- local addNum = self._model:getMaxNum() - bgSV:getAllNum()
	-- bgSV:pushVisibleRender(addNum)
	local bagPanel = self._view:getRightPanelByIndex(1)
	if bagPanel then
		local items = self._model:getItemsByIdx(self._curBagIdx)
		bagPanel:reloadListView(items, self._model:getMaxNum())
	end
end

function ClassRef:updateBag(uid, item, amountGot, opt)
	local updateIdx = self._model:updateBag(uid, item, amountGot, opt)
	
	if not self:isViewAlive() then return end

	self._view:refreshStrengthNeedItem(item:getId())

	local bagPanel = self._view:getRightPanelByIndex(1)
	if bagPanel then
		local items = self._model:getItemsByIdx(self._curBagIdx)
		bagPanel:reloadListView(items, self._model:getMaxNum(), true)
	end
	------------------------->>>>>>>>> 背包中物品发生变化的时候需要刷新身上装备的 状态标记 例如：是否可以继续强化等
	self._view:updatePlayerAllEquip()

	-- 更新背包数量
	if opt == "insert" or opt == "delete" then
		self._view:updateBagInfo( self._model:getBagInfo(), self._model:getCurNum(), self._model:getMaxNum() )
	end
end

-- 属性转移成功的回调
function ClassRef:attrTransSuccessCallback( itemUid )
	if not self:isViewAlive() then return end
	local bagSV = self._view:getScrollView()

	local itemData = UD:getItem( itemUid )

	bagSV:foreachVisibleCells(function(cell)
		-- local renderData = cell:getData()
		-- if renderData and itemData and renderData.uid == itemData.uid then
			cell:refresh()
		-- 	return true
		-- end
	end)
end

------------------------------ view logic -------------------------
function ClassRef:_getEquipTipParams(equip)
	local params = {
		tipsType = Enums.TipsType.equip,
		itemId = equip.tid,
		uid = equip.uid,
		dataTemp = equip,
		equipGrids = UD:getEquipGrids(),
		equips = UD.equips,
		class = UD:getClass(),
		level = UD:getLevel(),
		specialistId = UD:getCurSpecTypeId()
	}
	return params
end

-- 显示装备tip
function ClassRef:_showEquipTip( render )
	if not self:isViewAlive() then return end

	local equipData = render:getData()
	local params = self:_getEquipTipParams(equipData)
	params.unequipCallback = function()
			self._view:clearTips()
			self._model:confirmReqUnEquipEquipment(equipData.uid, equipData.tid, equipData:isEquipHasJewel())
		end

	-- 装备强化
	if string.find( GD:getSystemStrPar("recastlocation", "nil"), tostring( equipData:getPos() ) ) then -- 是可强化部位？
		params.strengthenCallback = function()
			self._view:clearTips( true )
			self._view:showEquipStrengthenUI( equipData )
		end
	end

	-- 可以镶嵌珠宝
	if equipData:canSetJewel() then
		params.slotCallback = function()
			UIHandler:handleMessage( { id = Constant.FUNC_TYPE_JEWEL, mode = "open", equipUid = equipData.uid, menuIndex = 1 } )
			self._view:clearTips( true )
		end
	end

	--可以镶嵌水晶
	if equipData:getRockNum() > 0 then
		params.crystalInlayCallback = function()
			UIHandler:handleMessage( { id = Constant.FUNC_TYPE_TIPS_CRYSTAL_INLAY, mode = "open", equipUid = equipData.uid} )
			self._view:clearTips( true )
		end
	end

	-- 移除幻化
	if equipData:isHaveIllusion() then
		params.removeIllusionCallback = function()
			self._model:reqUnIllusionEquip( equipData.uid )
		end
	end

	self._view:showTips(render, nil, params)
end

-- 显示背包道具tip
function ClassRef:_showItemTip( render ) -- item = render:getData() = self._model:getItemsByIdx(self._curBagIdx)[ X ]
	local item  = render:getData()
	if not item then
		return
	end
	local function onClickSellBtn() -- 出售
		self:showBagSellView( item )
	end
	local function onClickBreakBtn() -- 分解
		local breakParams = item:getBreakParamsByConf()
		local dropItemsIcon = {}
		local breakDropNums = {}
		for _, v in ipairs(breakParams) do
			local tempItem = UD:parseRewardToBagItem(v)
			local tempBreakParm = string.split(v, "|")
			local tempEachDecompeNum = tempBreakParm[3]
			table.insert(dropItemsIcon, tempItem:getIcon())
			table.insert(breakDropNums, tempEachDecompeNum * item.amount)
		end
		if item.isEquipHasJewel and item:isEquipHasJewel() then
			local breakItemDialog = display.newMessageBox(L('ErrEquipHaveJewelBreakFail'), function()
				render:setSelected(false)
			end)
			UIHandler:addPopDialog(breakItemDialog)
		elseif item.itemBagType == Enums.ItemBagType.equip and item:isEquipHasCrystal() then
			local breakItemDialog = display.newMessageBox(L('ErrEquipHaveRockBreakFail'), function()
				render:setSelected(false)
			end)
			UIHandler:addPopDialog(breakItemDialog)
		elseif 4 <= item:getQuality() then -- 紫色品质以上？
			local breakItemDialog = display.newConfirmDialog( L("ResolveWarning"),
				function() -- 确定
					self:showBagPgActView({op = "breakItem", breakType = {item.itemBagType}, uids = {item.uid},
                        num = {item.amount}, dropNum = breakDropNums, dropItem = dropItemsIcon})
				end)
			UIHandler:addPopDialog( breakItemDialog )
		else
			self:showBagPgActView({op = "breakItem", breakType = {item.itemBagType}, uids = {item.uid},
				num = {item.amount}, dropNum = breakDropNums, dropItem = dropItemsIcon})
		end
	end
	local function onClickUseBtn() -- 使用
		if self:isViewVisible() then
			self._view:clearTips()
		end
		self:useItem(item)
	end
	local function onClickIdentifyBtn() -- 鉴定
		-- if self:isViewVisible() then
		-- 	self._view:clearTips()
		-- end
		-- self:showBagPgActView( {op="identifyItem", uids={item.uid}} )
	end
	local function onClickTraceBtn() -- 追踪
		self:closeView()
		local param = {}
		param.trackNpcId = item.trackNpcId
		param.trackTaskId = nil
		param.autoStartEvents = false
		param.isTracking = true
		param.findCall = function(isFinding) end
		EM:notify("onTrackingWay",param)
	end
	local function onClickEquipBtn() -- 装备
		if item:needBindTip() then -- 装备绑定提示
			local function okFunc( dialogNode )
				self._model:confirmReqEquipEquipmentX(item)
				
				if self:isViewVisible() then
					self._view:clearTips()
				end
			end
			app:popMessage("bounditem", nil, { ok = okFunc })
		else
			if self:isViewVisible() then
				self._view:clearTips()
			end
			self._model:confirmReqEquipEquipmentX(item)
		end
	end
	-- 属性转移
	local function onTransAttrOfEquip() -- tips由操作更新关闭
		self:showTransAttrView( item.uid )
	end

	local leftParams
	local params

	if item.itemBagType == Enums.ItemBagType.equip then -- 装备
		-- 已穿装备
		local wearEquip = UD:getEquipByPos(item:getPos())
		if wearEquip then
			leftParams = self:_getEquipTipParams(wearEquip)
		end

		-- 背包中装备
		params = self:_getEquipTipParams(item)
		-- 可装备
		if item:isCanEquip() then
			params.equipCallback = onClickEquipBtn
		end
		-- 可以转移属性
		if item:canTransAttr() then
			params.attrTransCallback = onTransAttrOfEquip
		end
		-- 可以镶嵌珠宝
		if item:canSetJewel() then
			params.slotCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_JEWEL, mode = "open", equipUid = item.uid, menuIndex = 1 } )
				self._view:clearTips( true )
			end
		end
		--可以镶嵌水晶
		if item:getRockNum() > 0 then
			params.crystalInlayCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_TIPS_CRYSTAL_INLAY, mode = "open", equipUid = item.uid} )
				self._view:clearTips( true )
			end
		end

		if item:getAcType() ~= 0 and not item:isBind() then
			--需要跳转到拍卖行相应界面
			params.auctionCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_AUCTION_SHOP, mode = "open", tipsData = item} )
				self._view:clearTips( true )
			end
		end


		-- 移除幻化
		if item:isHaveIllusion() then
			params.removeIllusionCallback = function()
				self._model:reqUnIllusionEquip( item.uid )
			end
		end

		-- 可出售
		if UIHandler:isFunctionOpen(Constant.FUNC_TYPE_SELL_ITEM) and item:isCanSell() then
			params.sellCallback = onClickSellBtn
		end
		-- 可分解
		if item:isCanBreak() then
			params.decomposeCallback = onClickBreakBtn
		end
	elseif item.itemBagType == Enums.ItemBagType.jewel then -- 珠宝
		params = {
			tipsType = Enums.TipsType.jewel,
			itemId = item.tid,
			uid = item.uid,
			dataTemp = item
		}
		-- 珠宝镶嵌
		params.slotCallback = function()
			UIHandler:handleMessage( { id = Constant.FUNC_TYPE_JEWEL, mode = "open", menuIndex = 1,jewelUid = item.uid } )
			self._view:clearTips( true )
		end
		
		-- 升级
		if item:canContinueStrength() then
			params.upgradeCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_JEWEL, mode = "open", jewelUid = item.uid, menuIndex = 2 } )
				self._view:clearTips( true )
			end
		end

		-- 炼金
		params.transformCallback = function()
			UIHandler:handleMessage( { id = Constant.FUNC_TYPE_JEWEL, mode = "open", jewelUid = item.uid, menuIndex = 3 } )
			self._view:clearTips( true )
		end

		-- 可分解
		if item:isCanBreak() then
			params.decomposeCallback = onClickBreakBtn
		end

		if item:getAcType() ~= 0 and not item:isBind() then
			--需要跳转到拍卖行相应界面
			params.auctionCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_AUCTION_SHOP, mode = "open",tipsData = item} )
				self._view:clearTips( true )
			end
		end
	else
		params = {
			tipsType = Enums.TipsType.item,
			itemId = item.tid,
			uid = item.uid,
			dataTemp = item
		}
		if item.itemBagType == Enums.ItemBagType.item then
			params.tipsType = Enums.TipsType.item
		end

		-- 可使用
		if item:isCanUse() then
			-- 如果是属性条卷轴需要判断是否可使用
			if item:getItemType() ~= Enums.ItemType.transattr 
				or item:getItemType() ~= Enums.ItemType.allAttrScroll 
				or (item:getItemType() == Enums.ItemType.transattr and item:canTransAttr()) 
				or (item:getItemType() == Enums.ItemType.allAttrScroll and item:allAttrScrollCanTransAttr()) then
				params.useCallback = onClickUseBtn
			end			
		end
		-- 可鉴定
		local able, cost = item:getIdentify()
		if able then
			params.identifyCallback = onClickIdentifyBtn
			params.identifyCost = cost
		end
		-- 可分解
        if item.tid == Constant.Secondary_Crystal then --次级强化水晶特殊处理
            if UD:getCrystalCanBreak() and item:isCanBreak() then
                params.decomposeCallback = onClickBreakBtn
            end
        else
            if item:isCanBreak() then
                params.decomposeCallback = onClickBreakBtn
            end
        end

		-- 可出售
		if UIHandler:isFunctionOpen(Constant.FUNC_TYPE_SELL_ITEM) and item:isCanSell() then
			params.sellCallback = onClickSellBtn
		end
		-- 可追踪
		if item:isCanTrace() then
			params.trackCallback = onClickTraceBtn
		end

		--科拍卖
		if item:getAcType() ~= 0 and not item:isBind() then
			--需要跳转到拍卖行相应界面
			params.auctionCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_AUCTION_SHOP, mode = "open", tipsData = item} )
				self._view:clearTips( true )
			end
		end

		-- 如果是水晶 则显示一个强化按钮
		if item:getItemType() == Enums.ItemType.crystal then
			params.crystalUpgradeCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_TIPS_CRYSTAL_LVUP, mode = "open", data = {itemUid = item.uid, itemId = item.tid, isOnEquip = false} } )
				self._view:clearTips( true )
			end

			params.crystalInlayCallback = function()
				UIHandler:handleMessage( { id = Constant.FUNC_TYPE_TIPS_CRYSTAL_INLAY, mode = "open"} )
				self._view:clearTips( true )
			end
		end
	end

	
	if self:isViewVisible() then
		if leftParams then
			leftParams.shownOPbtn = true
			self._view:showTips(render, leftParams, params)
		else
			self._view:showTips(render, params)
		end
	end
end

function ClassRef:clearTips( ignoreSelect )
	if not self:isViewAlive() then return end
	self._view:clearTips( ignoreSelect )
end

-- 背包item点击操作
function ClassRef:_bagItemClick(render)
	if not self:isViewAlive() then return end

	local item = render:getData()
	if self._opType == 1 then -- 1.普通点击
		self._view:setCurRender(render)
		self:_showItemTip( render )
	elseif self._opType == 3 then -- 3.批量分解
		if render:isSelected() then
			if item.isEquipHasJewel and  item:isEquipHasJewel() then
				local breakItemDialog = display.newMessageBox(L('ErrEquipHaveJewelBreakFail'),function()
					render:setSelected(false)
				end)
				UIHandler:addPopDialog(breakItemDialog)
            elseif item.itemBagType == Enums.ItemBagType.equip and item:isEquipHasCrystal() then
			    local breakItemDialog = display.newMessageBox(L('ErrEquipHaveRockBreakFail'), function()
				    render:setSelected(false)
			    end)
			    UIHandler:addPopDialog(breakItemDialog)
			elseif 4 <= item:getQuality() then -- 紫色品质以上？
				local breakItemDialog = display.newConfirmDialog( L("ResolveWarning"),
					function() -- 确定
						self:_addMultRender(render)
					end,
					function() -- 取消
						render:setSelected(false)
					end)
				UIHandler:addPopDialog( breakItemDialog )
			else
				self:_addMultRender(render)
			end
		else
			self:_removeMultRender(item)
		end
	end
end

-- 时装panel切页
function ClassRef:_clothesPanelChangedIdx()
	self._view:setCurClothesRenderData( self._curClothesIdx, self._view:getCurClothesRenderDataByIdx( self._curClothesIdx ) )
end

-- 衣橱中时装item点击操作
function ClassRef:_clothesItemClick(render)
	if not self:isViewAlive() then return end
	self._view:setCurClothesRenderData( self._curClothesIdx, render:getData() )
end


-- 选中衣橱中时装时反向定位到人物身上时装
function ClassRef:selectedClothesRenderByPos( closthesPos )
	if not self:isViewAlive() then return end
	self._view:selectedClothesRenderByPos( closthesPos )
end

-- 预览时装
function ClassRef:_previewClothes( data )
	if not self:isViewAlive() then return end

	self._view:previewClothes( data )
end

-- 选中人物身上时装反向定位到衣橱中
function ClassRef:_plyerClothesItemClick(render)
	if not self:isViewAlive() then return end
	assert( 3 == self._curPanelIdx, "选中人物身上时装反向定位到衣橱中时 self._curPanelIdx ~= 3" ) --@ignore
	local item = render:getData()
	local curSelectedClothesData = self._view:getCurClothesRenderData()
	if item == curSelectedClothesData then -- 选中同一件时装
		return
	end
	-- 通过装备部件位置定位索引ID
	local clothesTagNeedChangedTo = GD:getClothesSubIDFromLocation( tonumber( GD:getClothesConfig( item ).location ) )
	if clothesTagNeedChangedTo then
		self._view:getRightPanelByIndex( self._curPanelIdx ):setCurSelectedIndex( tonumber( clothesTagNeedChangedTo ) )
		--self:_refreshPanel()
	end
	local clothes = self._model:getClothesByIdx(self._curClothesIdx)
	local indexof = nil
	for i,v in ipairs(clothes) do
		if tonumber( v ) == item then
			indexof = i
			break
		end
	end
	if indexof then
		self._view:getRightPanelByIndex( self._curPanelIdx ):getScrollView():scrollToIndex(indexof)
		self._view:setCurClothesRenderData( self._curClothesIdx, item )
	end
end

-- 使用时装
function ClassRef:_useClothes( clothesID )
	if not self:isViewAlive() then return end
	self._model:reqEquipFashion( clothesID )
end

-- 取消使用时装 参数为当前选中的第几个
function ClassRef:_unUseClothes( selectedIdx )
	if not self:isViewAlive() then return end
	local equipLocation = tonumber( GD:getClothesSubConfig( selectedIdx ).location )
	local equipGrid = UD:getEquipGridByPos(equipLocation)
	if equipGrid and equipGrid:getFashionId() > 0 then
		self._model:reqRemoveFashion( equipGrid:getFashionId() )
	end
end

-- 幻化状态改变刷新clothesPanel的下部状态
function ClassRef:refreshCurSelectedClothesStatus()
	if not self:isViewAlive() then return end

	self._view:getRightPanelByIndex( 3 ):refreshPanelEquip()
end

-- 刷新背包中物品的各种标记状态
function ClassRef:refreshBagItemStatus( pos )
	if not self:isViewAlive() then return end

	local bagSV = self._view:getScrollView()
	bagSV:refreshVisibleCells(function(render)
		local item = render:getData()
		if item and item.itemBagType==Enums.ItemBagType.equip
			and pos == item:getPos() then
				render:setTransferred( item:canTransAttr() )
				render:setStrengthen( item:isBetterThanEquipOnPlayer() )
		end
	end)
end

-- 装备格子强化完成处理
function ClassRef:refreshEquipStrengthResult( equipUid )
	if not self:isViewAlive() then return end

	local equipData = UD:getEquip( equipUid )
	local euqipPos = equipData:getPos()
	self._view:getEquipRender( euqipPos ):setData( equipData )
	self._view:showEquipStrengthenUI( equipData )

	-- 刷新背包中的装备的强化等级
	-- local bagSV = self._view:getScrollView()
	-- local bagRenders = bagSV:getVisibleRenders()
	-- for i,render in ipairs(bagRenders) do
	-- 	local item = render:getData()
	-- 	if item then
	-- 		if item:getPos() == euqipPos then
	-- 			render:refresh()
	-- 		end
	-- 	end
	-- end
end

-- 播放强化成功动画
function ClassRef:playStrengthSuccessAmi()
	if not self:isViewAlive() then return end
	self._view:playStrengthSuccessAmi()
end

-- 播放强化失败动画
function ClassRef:playStrengthFailAmi()
	if not self:isViewAlive() then return end
	self._view:playStrengthFailAmi()
end

-- function ClassRef:_setBagTabRedPoint(trueOrFalse)
-- 	self._view:updateTabBtnRedPoint( 1, trueOrFalse )
-- 	UD.redPoint:getStateByKey(Constant.FUNC_TYPE_PACK_WARDROBE)
-- end


function ClassRef:_onRedPointChange(changeKeys)
	if not self:isViewAlive() then return end

	if changeKeys[RedPointConstant.Bag_NewItem] ~= nil or 
		changeKeys[Constant.FUNC_TYPE_PACK_TREASURE] ~= nil or 
		changeKeys[Constant.FUNC_TYPE_PACK_WARDROBE] ~= nil or 
		changeKeys[Constant.FUNC_TYPE_PACK_TITLE] ~= nil or
		changeKeys[Constant.FUNC_TYPE_PACK_PRESTIGE] ~= nil then

		self._view:refreshTabBtnRedPoint()
	end

	if changeKeys[Constant.FUNC_TYPE_CORE_PROP] ~= nil or 
		changeKeys[RedPointConstant.RecastMonster_Exchange] ~= nil then

		self._view:refreshPlayerRedPoint()
	end

	if changeKeys[RedPointConstant.Clothes_1] ~= nil or 
		changeKeys[RedPointConstant.Clothes_2] ~= nil or 
		changeKeys[RedPointConstant.Clothes_3] ~= nil or 
		changeKeys[RedPointConstant.Clothes_4] ~= nil or
		changeKeys[RedPointConstant.Clothes_5] ~= nil or
		changeKeys[RedPointConstant.Clothes_6] ~= nil then

		self._view:refreshClothesRedPoint()
	end

end


function ClassRef:_refreshPanel( forceRefresh )
	if not self:isViewAlive() then return end
	local panelTemp = self._view:getRightPanelByIndex( self._curPanelIdx )
	local scrollView = panelTemp:getScrollView()

	if 1 == self._curPanelIdx then -- 背包
		local items = self._model:getItemsByIdx(self._curBagIdx)
		-- local resNum = self._model:getMaxNum() - #items
		panelTemp:reloadListView(items, self._model:getMaxNum())
		if self._view:isMultSVShown() then
			panelTemp:setAllCellsMaskState(true)
			if self._multSelectDict then
				scrollView:foreachCellModels(function(cellModel, renderData)
					if renderData and self._multSelectDict[renderData.uid] then
						if cellModel.cell then
							cellModel.cell:setSelected(true)
						else
							cellModel:setUIState("selected", true)
						end
					end
				end)
			end
		end
	elseif 2 == self._curPanelIdx then -- 宝物
		if forceRefresh then
			panelTemp:refreshView()
			-- local dataTemp = self._model:getRareLists()
			-- scrollView:refreshList( dataTemp )
		end
	elseif 3 == self._curPanelIdx then -- 时装
		--根据当前选择的时装分类 读表获得当前时装栏显示数据
		local clothes = self._model:getClothesByIdx(self._curClothesIdx)
		local resNum = 0 -- 额外格子数
		scrollView:reloadData(clothes)

		if not self._clothesInit then
			self._clothesInit = true
			-- 为每一项选择默认时装  (TODO 可以等切换的时候再搜索默认时装)
			for i = 1, ClothesPanel_Top_OpItemNum do
				local clothesTemp = self._model:getClothesByIdx( i )
				--这一段逻辑需要判断当前部位是否有幻化 有幻化的话要选中相对应的 若无幻化则选中第一个默认X
				local equipLocationPos = GD:getClothesSubLocationFromID( i )
				local equipGridTemp = UD:getEquipGridByPos( equipLocationPos )

				local fashionId = 0
				if equipGridTemp then
					fashionId = equipGridTemp:getFashionId()
				end
				print("initSelectedRenderListData", i, fashionId)
				panelTemp:initSelectedRenderListData( i , fashionId )
			end

			-- 刷新红点
			panelTemp:refreshRedPoint()
		end

		local fashionId = self._view:getCurClothesRenderDataByIdx( self._curClothesIdx )
		self._view:setCurClothesRenderData( self._curClothesIdx, fashionId )
	elseif 4 == self._curPanelIdx then -- 称号
		local dataTemp = UD:getTitles()
		scrollView:refreshList( dataTemp )
	elseif 5 == self._curPanelIdx then -- 声望
		local dateTemp = self._model:getFameLists()
		scrollView:refreshList( dateTemp )
	else
		-- print( " ------------------>>>>>>> _refreshPanel: 选中右侧未知索引位：".. self._curPanelIdx )
	end
end

-- 1	背包
-- 2	宝物
-- 3	时装
-- 4	称号
-- 5	声望
function ClassRef:onSwitchPanel(idx)
	if not self:isViewAlive() then return end

	-- 切换时清理红点
	if self._curPanelIdx == 1 then
		self._model:clearAllNew()
		UD.redPoint:clearStateByKey(RedPointConstant.Bag_NewItem)
	elseif self._curPanelIdx == 2 then
		-- UD:clearCharmNumNew()
	elseif self._curPanelIdx == 3 then
		UD:clearClothesNewByIdx()
	elseif self._curPanelIdx == 4 then
		UD:clearNewGotTitleList()
		UD.redPoint:clearStateByKey(Constant.FUNC_TYPE_PACK_TITLE)
	elseif self._curPanelIdx == 5 then
		UD:clearNewGotRenown()
		UD.redPoint:clearStateByKey(Constant.FUNC_TYPE_PACK_PRESTIGE)
	end

	self._curPanelIdx = idx
	self:_refreshPanel()

	if 3 == self._curPanelIdx then
		self._view:updatePlayerClothes()
	end
end

function ClassRef:_addMultRender(render)
	if not self:isViewAlive() then return end


	local item = render:getData()
	if self._multSelectDict[item.uid] then
		return
	end

	self._multSelectNum = self._multSelectNum + 1
	self._multSelectDict[item.uid] = item

	local mulPanel = self._view:getMulPanel()
	if mulPanel then
		mulPanel:addItem(item)
	end

	self:refreshBreakGotInfo()
end

function ClassRef:_removeMultRender(item)
	if not self:isViewAlive() then return end
	local mulPanel = self._view:getMulPanel()
	local bagPanel = self._view:getRightPanelByIndex(1)
	if not mulPanel or not bagPanel then
		return
	end
	bagPanel:setSelectedStateByItem(item, false)
	mulPanel:deleteItem(item)
	self._multSelectDict[item.uid] = nil
	self._multSelectNum = self._multSelectNum - 1
	self:refreshBreakGotInfo()
end

-- 批量分解物品发生改变时刷新分解获取信息
function ClassRef:refreshBreakGotInfo()
	if not self:isViewAlive() then return end

	local temp = nil
	local decomType, decomId, decomNum, eachDecomNum
	for k,renderData in pairs(self._multSelectDict) do
		if not temp then temp = {} end
		local lvBreakParams = renderData:getBreakParamsByConf()
		if lvBreakParams then
			for k, v in ipairs(lvBreakParams) do
				local ary = string.split(v, "|")
				decomType = ary[1]
				decomId = ary[2]
				eachDecomNum = ary[3] or 0
				decomNum = eachDecomNum * renderData:getAmount()

				if temp[decomType] then -- 前面存在同类型掉落
					if temp[decomType][decomId] then -- 存在同类型、同id的掉落
						temp[decomType][decomId] = temp[decomType][decomId] + decomNum
					else
						temp[decomType][decomId] = decomNum
					end
				else
					temp[decomType] = {}
					temp[decomType][decomId] = decomNum
				end
			end
		end
	end
	self._view:refreshDecomposeGotNum(temp)
end

-- 自动选择白色品质道具出售，自动选择蓝色及以下道具分解
-- 取消选择，直接取消所有选择
function ClassRef:_multAutoChoose(isAuto)
	if not self:isViewAlive() then return end
	local mulPanel = self._view:getMulPanel()
	local bagPanel = self._view:getRightPanelByIndex( 1 )
	if not mulPanel or not bagPanel then
		return
	end

	local multSV = self._view:getMultSV()
	local oldData = multSV:getData()
	local bagSV = self._view:getScrollView()
	if isAuto then
		-- 已选择的道具
		local items = {}
		for i,item in ipairs(oldData) do
			table.insert(items, item)
		end
		-- bagSV:foreach
		-- 自动选择剩下满足要求且未选择的道具
		bagSV:foreachCellModels(function(cellModel, item)
			if item and not self._multSelectDict[item.uid] then
				if self._opType == 3 then
					if item.tid == Constant.Secondary_Crystal then    --次级强化水晶特殊处理
						if UD:getCrystalCanBreak() then
							if cellModel.cell then
								cellModel.cell:setSelected(true)
							else
								cellModel:setUIState("selected", true)
							end
							table.insert(items, item)
							self._multSelectDict[item.uid] = item
						end
					else
						if item:isCanAutoBreak() then
							if not (item.isEquipHasJewel and item:isEquipHasJewel()) then
								if cellModel.cell then
									cellModel.cell:setSelected(true)
								else
									cellModel:setUIState("selected", true)
								end
								table.insert(items, item)
								self._multSelectDict[item.uid] = item
							end
						end
					end
				end
			end
		end)
		mulPanel:reloadListView(items)
		self._multSelectNum = #items
		self:refreshBreakGotInfo()
	else
		self._multSelectDict = {}
		self._multSelectNum = 0
		mulPanel:reloadListView({})
		bagPanel:setAllCellsSelectedState(false)
		self:refreshBreakGotInfo()
	end
end

function ClassRef:_refreshMultPanel()
	if not self:isViewAlive() then return end

	self._multSelectDict = {}
	self._multSelectNum = 0
	local mulPanel = self._view:getMulPanel()
	local bagPanel = self._view:getRightPanelByIndex( 1 )
	if not mulPanel or not bagPanel then
		return
	end
	mulPanel:reloadListView({})
	bagPanel:setAllCellsMaskState(true)
end
-- 关闭BagMultPanel
function ClassRef:closeMultPanle()
	if not self:isViewAlive() then return end
	self._view:switchOpType( 1 )
end

-- 1	普通点击，显示道具tip
-- 3	批量分解，
function ClassRef:onSwitchOpType(type)
	if not self:isViewAlive() then return end

	self._opType = type

	if self._opType == 1 then
		-- 清除选中和遮罩效果
		if self._multSelectDict then
			local bagPanel = self._view:getRightPanelByIndex(1)
			bagPanel:resetCellsState()
			self._multSelectDict = nil
		end
	else
		self:_refreshMultPanel()
	end
end

--显示隐藏的头盔部分
function ClassRef:_showHeadFashion()
    if not self:isViewAlive() then return end
    local list = {}
    local equipGrid = UD:getEquipGridByPos(Enums.EquipType.head) --目前先写死，只隐藏头盔部分。以后可能会改
    if equipGrid then
        table.insert(list, {gridId = equipGrid:getLocation(), hidden = not equipGrid:getHidden()})
    end
    if #list > 0 then
        self._model:reqHideFashion(list)
    end
end

function ClassRef:onOperate(op, ...)
	-- print("NewBagController.onOperate , op)
	-- dum, "NewBagController.onOperate data")
	local data = ...
	if op == "BagPanel_changeTag" then -- 背包panel切标签tag
		assert( 1 == self._curPanelIdx, "--------------->>>>>> 认定只有处于第一个panel(背包)时才会接收到此操作的通知" )

		self._curBagIdx = data
		self:_refreshPanel()
	elseif op == "RareRender_jumpTo" then -- 宝物跳转
		local featureonConf = GD:queryFeatureOnById( data.point )
		if featureonConf then
			if featureonConf.questId and "" ~= featureonConf.questId then -- 任务控制？
				if UD:isMainTaskFinished( featureonConf.questId ) then -- 任务完成？
					UIHandler:handleMessage({id = tonumber( data.point ), mode = "open"})
				else
					local taskConf =  GD:queryTaskById( featureonConf.questId )
					local str = string.format( L("afterFinishTask"), L(taskConf.name) )
					display.pushToast( str )
				end
			else
				if tonumber( featureonConf.level ) >= UD:getLevel() then
					display.pushToast( L("ErrPlayerLvNotEnough") )
				else
					UIHandler:handleMessage({id = tonumber( data.point ), mode = "open"})
				end
			end
		else
			print( " ------------------------>>>>> 宝物跳转功能Id对应配置不存在 ", data.point )
		end
		
	elseif op == "BagPanel_clickItem" then
		self:_bagItemClick(data)
	elseif op == "BagMultPanel_clickItem" then
		--批量分解点击
		self:_removeMultRender(data:getData())
	elseif op == "BagPanel_showBagUp" then -- 点击背包升级按钮
		self:showBagUpView()
	elseif op == "BagPanel_sortItem" then -- 整理背包
		self._model:reqSortItem()
	elseif op == "ClothesPanel_clickItem" then
		self:_clothesItemClick(data)
	elseif op == "ClothesPanel_changeTag" then -- 时装panel切标签tag
		if self._curClothesIdx > 0 then
			UD:clearClothesNewByIdx(self._curClothesIdx)
		end

		self._curClothesIdx = data
		self:_refreshPanel()

		self:_clothesPanelChangedIdx()
	elseif op == "ClothesPanel_useClothes" then -- 使用时装
		self:_useClothes( data )
	elseif op == "ClothesPanel_downClothes" then -- 下载时装
		self:_unUseClothes(self._curClothesIdx)
	elseif op == "ClothesPanel_selectedClothesFromClothesPanel" then -- 衣橱选中时装时反向定位到人物身上
		self:selectedClothesRenderByPos( data )
	elseif op == "ClothesPanel_previewClothes" then --  时装预览
		self:_previewClothes( data )
	elseif op == "BagUpPanel_extendBag" then -- 升级背包
		self._model:reqExtendBag()
	elseif op == "PlayerPanel_showEquipTip" then -- 人物身上装备显示装备tip
		self:_showEquipTip( data )
	elseif op == "PlayerPanel_selectedClothes" then -- 人物身上时装选中、反向定位到衣橱中
		self:_plyerClothesItemClick( data )
	elseif op == "RareRender_explain" then -- 宝物详情
		self._view:showRareInfo( data )
	elseif op == "TitleRender_changeSelectedStatus" then -- 切换称号选中状态
		self._model:reqChangeTitle( data )
	elseif op == "RenownPanel_buyRenown" then -- 购买声望
		local conf = GD:queryFameById( data.id )
		local shopConf = GD:queryShopById(tonumber(conf.shopID))
		if not shopConf then
			display.pushToast(L("tips_2000111"))
			return
		end
		app:sendMsg("PrestigeShopController", "openView", { shopId = tonumber( conf.shopID ) })
	elseif op == "RenownPanel_removeNewFlag" then -- 移除声望新标记
		self:_refreshPanel()
	elseif op == "useItem" then -- 使用道具
		self._model:reqUseItem(...)
	elseif op == "sellItem" then -- 出售
		self._model:reqSellItem( data[1], data[2] )
	elseif op == "studyPaper" then -- 使用图纸
		self._model:reqStudyPaper( data[1], data[2] )
	elseif op == "breakItem" then -- 分解
		local breakTypeListTemp = {}
		for i,v in ipairs( data[1] ) do
			local breakTypeTemp = nil
			if Enums.ItemBagType.item == tonumber( v ) then
				breakTypeTemp = "break_item"
			elseif Enums.ItemBagType.equip == tonumber( v ) then
				breakTypeTemp = "break_equip"
			elseif Enums.ItemBagType.jewel == tonumber( v ) then
				breakTypeTemp = "break_jewel"
			end
			table.insert( breakTypeListTemp, breakTypeTemp )
		end
		local tempList = {}
		for i,v in ipairs( breakTypeListTemp ) do
			local temp = {
				breakType = v,
				uid = data[2][i],
				num = data[3][i],
			}
			table.insert( tempList, temp )
		end
		self._model:reqBreakItems( tempList )
	elseif op == "identifyItem" then -- 鉴定
		-- self._model:reqIdentifyItem( data )
	elseif op == "TransAttrOfEquip_sure" then -- 装备属性转移确定
		self._model:reqTransEquipAttr( data )
	elseif op == "AddEquipExtraProp_sure" then -- 属性条卷轴属性转移确定
		self._model:reqAddEquipExtraProp( data )
	elseif op == "equipStrengthen_strength" then -- 装备格子强化
		self._model:reqStrengthEquipGrid( data )
	elseif op ==  "equipStrengthen_strength_ten" then -- 装备格子强化
		self._model:reqStrengthEquipGridTen( data )
	elseif op == "autoChoose" then
		-- 批量操作，是否自动选择
		self:_multAutoChoose(...)
	elseif op == "doMultAct" then
		-- 批量出售／批量分解
        dump(data)
		if self._opType == 3 then -- 批量分解
			-- data[1]--道具类型列表  data[2]--道具uid列表  data[3]--道具数量列表
			self:showBagPgActView({op="breakItem", breakType=data[1], uids=data[2], num=data[3], multiBreak = true, dropNum=data[4], dropItem = data[5]})
		end
	elseif op == "PlayerPanel_OpenCorePropView" then
		-- 打开核心属性界面
		app:sendMsg("CorePropController", "openView")
	elseif op == "PlayerPanel_ReqAttrList" then
		if data == "attr" then
			self._model:reqQueryMyProp()
		elseif data == "recastMaster" then
			self:updateRecastMaster()
		end
    elseif op == "PlayerPanel_ShowHeadFashion" then --显示隐藏的头盔部分
        self:_showHeadFashion()
	elseif op == "renamePlayer" then
		--改人名
		self._model:reqRenamePlayer(data)
	elseif op == "renameGuild" then
		self._model:reqRenameGuild(data)
	elseif op == "quickStrength" then
		--一键强化
		--dump("一键强化")
		self._model:reqQuickStrength()
	end
end


return ClassRef
